package control;

import control.profiler.Profiler;
import control.reader.RenderSetupReader;
import control.render.RenderSetup;
import gui.MainWindow;
import data.hierarchy.World;

public class Core {

  private World world;
  private MainWindow mainWindow;
  private RenderSetup renderSetup;
  
  private static final String CONFIG_FILE = "config.properties";
  
  public static void main(String[] args) {
    Core c = new Core();
    c.init();
  }
  
  public Core(){
    
  }
  
  public void init(){
    Profiler.getInstance().record("Building world...");    
    RenderSetupReader setupReader = new RenderSetupReader(CONFIG_FILE);
    world = setupReader.getWorld();
    Profiler.getInstance().display();
    
    renderSetup = setupReader.getRenderSetup();
    
    mainWindow = new MainWindow(this);
    mainWindow.setVisible(true);
    mainWindow.getRenderController().render();
  }

  public World getWorld() {
    return world;
  }

  public MainWindow getMainWindow() {
    return mainWindow;
  }

  public RenderSetup getRenderSetup() {
    return renderSetup;
  }
}
